<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>标准规范</title>
    <script src="../../../js/header.js"></script>
</head>
<body>
<div id="pub" style="overflow: hidden;">
    <el-row type="flex" justify="center">
        <el-col :span="15">
            <el-breadcrumb separator-class="el-icon-arrow-right" style="margin-top: 20px;">
                <el-breadcrumb-item :to="{ path: '/' }"  @click.native="gobackmain()">首页</el-breadcrumb-item>
                <el-breadcrumb-item>标准规范</el-breadcrumb-item>
            </el-breadcrumb>
            <!--展示列表-->
            <el-table :data="tableData" border style="width: 100%;margin-top: 35px;" :header-cell-style="{background:'#eef1f6',color:'#606266'}">
                <el-table-column type="selection" ></el-table-column>
                <el-table-column
                        prop=""
                        type="index"
                        label="序号"
                        width="50"
                        align="center" >
                </el-table-column>
                <el-table-column
                        prop="createUser"
                        label="拟制人"
                        width="100"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="createUserUnit"
                        label="拟制人机构"
                        width="150"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="createTime"
                        label="拟制时间"
                        width="150"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="releaseTime"
                        label="发布时间"
                        width="150"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="status"
                        label="状态"
                        width="100"
                        align="center">
                    <template slot-scope="scope">
                        <span v-if="scope.row.status==0">未发布</span>
                        <span v-if="scope.row.status==1">已发布</span>
                        <span v-if="scope.row.status==2">已撤销</span>
                    </template>
                </el-table-column>
                <el-table-column
                        prop="title"
                        label="标题"
                        width="200"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="publicityContent"
                        label="公示通报内容"
                        width="250"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="publicType"
                        label="公布位置"
                        width="100"
                        align="center">
                    <template scope="scope">
                        <span v-if="scope.row.status==0" style="color:#F19437;">服务门户</span>
                        <span v-if="scope.row.status==1" style="color:#20A0FF;">工作门户</span>
                        <span v-if="scope.row.status==2" style="color:#FF4949;">服务和工作门户</span>
                    </template>
                </el-table-column>
                <el-table-column
                        label="操作"
                        width="150"
                        align="center">
                    <template slot-scope="scope">
                        <el-button size="mini" @click="view(scope.$index,scope.row)">查看详情</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div style="overflow: hidden;">
                <div class="pagination">
                    <el-pagination
                            @size-change="handleSizeChange"
                            @current-change="handleCurrentChange"
                            :current-page="currentPage"
                            :page-sizes="[5,10, 20, 30, 40]"
                            :page-size="pagesize"
                            background
                            layout="total, sizes,prev, pager, next"
                            :total="tableTotal"
                            prev-text="上一页"
                            next-text="下一页">
                    </el-pagination>
                </div>
            </div>
            <!--详情-->
            <el-dialog title="" :visible.sync="dialogView" center fullscreen>
                <gonggao-details :addform="addForm" :link="link"></gonggao-details>
            </el-dialog>
        </el-col>
    </el-row>
</div>
</body>
<script type="text/javascript">
    var vue = new Vue({
        el: '#pub',
        created: function () {
            var userInfo = JSON.parse(localStorage.getItem('userInfo'));
            this.name = userInfo.loginName;
        },
        data: function () {
            return {
                currentPage: 1,
                pagesize: 5,
                tableTotal:'',
                tableData: [],
                selectFormDisabled:false,
                selectForm: {
                    id:'',
                    title:'',
                    publicType:'0',
                },
                dialogView:false,
                uuid:'',
                from:'',
                link:'',//iframe链接
                addForm: {
                    id:'',
                    createUser:'',
                    createUserUnit:'',
                    createTime:'',
                    title:'',
                    publicityContent:'',
                    publicType:'',
                    from:''
                },
                addFormDisabled:false,
            }
        },
        mounted: function () {
            this.getData();
        },
        methods: {
            getData() {
                var pagesize = this.pagesize;
                var pageno = this.currentPage;
                axios({
                    method: 'get',
                    url: '/dzjportal/promulgate/allList',
                    params: {
                        pageSize: pagesize,
                        pageNo: pageno,
                        publicType:this.selectForm.publicType,
                        isPublic:'1'
                    }
                })
                    .then(response => {
                        let data = response.data;
                        if (data.code == 200) {
                            let dataInformation = response.data.data.results;
                            this.tableTotal = response.data.data.total;// 数据长度
                            this.tableData = dataInformation;
                        } else {
                            this.$message.error(data.msg);
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            /* 列表页搜索 */
            searchForm(selectForm) {
                var pagesize = this.pagesize;
                var pageno = this.currentPage;

                axios({
                    method: 'get',
                    url:  '/dzjportal/promulgate/titleList',
                    params: {
                        pageSize: pagesize,
                        pageNo: pageno,
                        title: this.selectForm.title,
                        publicType:this.selectForm.publicType,
                        isPublic:'1'
                    }
                })
                    .then(response => {
                        let data = response.data;
                        if (data.code == 200) {
                            let dataInformation = response.data.data.results;
                            this.tableTotal = response.data.data.total;// 数据长度

                            this.tableData = dataInformation;
                        } else {
                            this.$message.error(data.msg);
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            /* 列表页重置 */
            resetForm(formName) {
                this.selectForm.title = '';
                this.getData();
            },
            //每页下拉显示数据
            handleSizeChange(size) {
                this.pagesize = size;
                this.getData();
            },
            //点击第几页
            handleCurrentChange(currentPage) {
                this.currentPage = currentPage;
                this.getData();
            },
            //查看
            view(index,row){
                this.dialogView=true;
                this.addFormDisabled=true;
                this.link = appBaseUrl + "/html/upload/annex.html?uuid="+row.id+"&flag=0&from="+row.from;
                axios({
                    method: 'get',
                    url: '/dzjportal/promulgate/selectOne',
                    params: {
                        id: row.id,
                        from:row.from
                    }
                })
                    .then(response => {
                        let data = response.data;
                        if (data.code == 200) {
                            let rowdata = response.data.data;
                            this.addForm = rowdata;
                        } else {
                            this.$message.error(data.msg);
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            gobackmain(){
                parent.vue.backIndex();
            },

        },
    })
</script>
</html>
